import { IFeidaoAiBrowserComponent } from '@feidao/web/interfaces';
import storage_get from '@feidao/web/atom/browser/storage/get';
import render from "@feidao/web/atom/browser/render/render";
import nodejs from "@feidao/web/atom/browser/msg/nodejs";
import P01 from './P01';
import P02 from './P02';

export default async function a005(fd: IFeidaoAiBrowserComponent, ...args: any[]) {
	// 初始化事件
	// 获取用户信息
	// const user_info = await storage_get('user', 'user');
	// const user_code = user_info.user_code;
	const user_code = 'admin';

	// 获取数据
	const data = await nodejs(fd.data.spaceid, 'desk_screen_main_find', { filter: { user_code } });
	// 计算宽度
	const s = fd.data.node.querySelector<HTMLDivElement>('[data-feidao-id="bar"]').getBoundingClientRect()
	const w = s.width;
	const res = { w, data };
	// 渲染
	render(fd, res, P01, 'P01', 'inner');
	render(fd, res, P02, 'P02', 'inner');
}
